-
-
Notifications
You must be signed in to change notification settings - Fork 512
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(template-vite): ignore browser
field for isomorphic packages
#3218
Conversation
Request code review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jclab-joseph CI Lint failed. You can try execute: npx prettier --write . |
Packages like axios have a browser field in package.json. The main process needs to resolve the node module, not the browser module.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@caoxiemeihao Do you have anything to add? |
Wait a moment 😅 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just keep the browserField
, and in the future as well :)
export default defineConfig({
resolve: {
// Some libs that can run in both Web and Node.js, such as `axios`, we need to tell Vite to build them in Node.js.
browserField: false,
},
});
This code will break in the future if you only use browserField. It is okay? |
It doesn't make sense that you set the |
What I'm concerned about is when Vite completely removes browserField functionality. |
Vite |
I don't understand yet... It is written that instead of removing |
@jclab-joseph Sorry, I misread! |
LGTM. But I don't have merge permission. Request CR/Merge @erickzhao @VerteDinde |
browser
field for isomorphic packages
Thank you for the contribution! Sorry for the edit history, I tried to make the PR title clearer and more concise. |
Packages like axios have a browser field in package.json. The main process needs to resolve the node module, not the browser module.
Summarize your changes:
Packages like axios have a browser field in package.json.
The main process needs to resolve the node module,
not the browser module.